package com.shiyo.spring.basic_di.b_constructor;

import com.shiyo.spring.basic_di.b_constructor.bean.Person;
import com.shiyo.spring.basic_di.b_constructor.config.PersonConfig;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ConstructorInjectApplication {
    public static void main(String[] args) {
        BeanFactory factory = new ClassPathXmlApplicationContext("basic_di/b-constructor.xml");
        Person person = (Person) factory.getBean("person");
        System.out.println(person);

        ApplicationContext context = new AnnotationConfigApplicationContext(PersonConfig.class);
        Person person1 = (Person)context.getBean("person");
        System.out.println(person1);
    }
}
